//
// Created by sgyt on 2020/2/9.
// getlogin函数，如果是守护进程失败
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>s
int main(int argc,char *argv[])
{
    char *name;
    name = getlogin();
    printf("login name is [%s]\n",name);

    int res = setpriority(PRIO_PROCESS,getpid(),10);
    if(res < 0)
    {
        perror("setpriority is error\n");
    }

    //使用getpriority函数
    int nice_value;
    nice_value = getpriority(PRIO_PROCESS,getpid());
    printf("pid = [%d],process nice is [%d]\n",getpid(),nice_value);
    return 0;
}

